import sys 
from PySide6.QtGui import QAction, QIcon
from PySide6.QtCore import Qt, QSize
from PySide6.QtWidgets import QApplication, QMainWindow, QLabel, QToolBar, QStatusBar, QCheckBox

class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()

        self.setWindowTitle("My App")

        toolbar = QToolBar("Main Toolbar")
        toolbar.setIconSize(QSize(16, 16))
        toolbar.setToolButtonStyle(Qt.ToolButtonIconOnly) # 设置 QAction 样式

        action_button1 = QAction(QIcon("bug.png"), "Your buttton1", self)
        action_button1.setStatusTip("Your button1")
        action_button1.setCheckable(True)
        action_button1.triggered.connect(self.action_button1_triggered)
        toolbar.addAction(action_button1)

        action_button2 = QAction(QIcon("bug.png"), "Your buttton2", self)
        action_button2.setStatusTip("Your button2")
        action_button2.setCheckable(True)
        action_button2.triggered.connect(self.action_button2_triggered)
        toolbar.addAction(action_button2)

        toolbar.addWidget(QLabel("Hello"))
        toolbar.addWidget(QCheckBox())

        self.addToolBar(toolbar)

    def action_button1_triggered(self, s):
        print("action_button1 triggered: ", s)

    def action_button2_triggered(self, s):
        print("action_button2 triggered: ", s)

app = QApplication(sys.argv)
window = MainWindow()
window.show()
app.exec()


    

